package io.github.yuazer.pokecommandpro.Commands;

import io.github.yuazer.pokecommandpro.Main;
import io.github.yuazer.pokecommandpro.Utils.YamlUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class commands implements CommandExecutor {
    YamlUtils utils = new YamlUtils();

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("pokecommandpro")) {
            if (args.length == 0) {
                sender.sendMessage("§a/pokecommand help  -  §e查看指令");
            } else {
                switch (args[0]) {
                    case "reload":
                        if (sender.hasPermission("pokecommand.admin")) {
                            Main.getInstance().reloadConfig();
                            sender.sendMessage(utils.getConfigMessage("Message.reload"));
                        }
                        break;
                    case "help":
                        if (sender.hasPermission("pokecommand.admin")) {
                            sender.sendMessage("§a/pokecommand reload  -  §e重载插件");
                        }
                        break;
                    default:
                        sender.sendMessage("§a/pokecommand help  -  §e查看指令");
                }
            }
        }
        return true;
    }
}
